import { datashopAxios } from '@/utils/request'

// 获取所有标签
export const getProductCategoryList = (params: any): Promise<any> => {
  return datashopAxios({
    url: `/api/datashop/v3/tags`,
    method: 'get',
    params
  })
}

// 创建标签
export const addProductCategory = (data: any) => {
  return datashopAxios({
    url: `/api/datashop/v3/tags`,
    method: 'post',
    data
  })
}

// 更新标签
export const editProductCategory = (data: any): Promise<any> => {
  return datashopAxios({
    url: `/api/datashop/v3/tags/${data.id}`,
    method: 'put',
    data
  })
}

// 删除标签
export const deleteProductCategory = (data: any): Promise<any> => {
  return datashopAxios({
    url: `/api/datashop/v3/tags/${data.id}`,
    method: 'delete',
    data
  })
}

// 上移标签
export const upProductCategory = (data: any) => {
  return datashopAxios({
    url: `/api/datashop/v3/tags/${data.id}:move-up`,
    method: 'post',
    data
  })
}

// 下移标签
export const downProductCategory = (data: any) => {
  return datashopAxios({
    url: `/api/datashop/v3/tags/${data.id}:move-down`,
    method: 'post',
    data
  })
}

// 数据产品列表
export const getDataProductList = (params: any): Promise<any> => {
  return datashopAxios({
    url: `/api/datashop/v3/data-products`,
    method: 'get',
    params
  })
}
// 上移数据产品
export const moveUpDataProductList = (data: any): Promise<any> => {
  return datashopAxios({
    url: `/api/datashop/v3/data-products/${data.id}:move-up`,
    method: 'post',
    data
  })
}
// 上移数据产品
export const moveDownDataProductList = (data: any): Promise<any> => {
  return datashopAxios({
    url: `/api/datashop/v3/data-products/${data.id}:move-down`,
    method: 'post',
    data
  })
}

// 获取数据集产品包含的数据项
export const getDataCollectProductDataItemList = (params: any): Promise<any> => {
  const { id, ...rest } = params
  return datashopAxios({
    url: `/api/datashop/v3/data-item-set-products/${id}/data-items`,
    method: 'get',
    params: rest
  })
}

// 获取数据集产品
export const getDataCollectProductDetail = (params: any): Promise<any> => {
  return datashopAxios({
    url: `/api/datashop/v3/data-item-set-products/${params.id}`,
    method: 'get',
    params
  })
}
// 更新数据集产品
export const editDataCollect = (data: any): Promise<any> => {
  return datashopAxios({
    url: `/api/datashop/v3/data-item-set-products/${data.id}`,
    method: 'put',
    data
  })
}
// 创建数据集产品
export const addDataCollect = (data: any) => {
  return datashopAxios({
    url: `/api/datashop/v3/data-item-set-products`,
    method: 'post',
    data
  })
}
// 删除数据集产品
export const deleteDataCollect = (data: any): Promise<any> => {
  return datashopAxios({
    url: `/api/datashop/v3/data-item-set-products/${data.id}`,
    method: 'delete',
    data
  })
}

// 获取网站产品详情
export const getWebsiteProductDetail = (params: any): Promise<any> => {
  return datashopAxios({
    url: `/api/datashop/v3/website-products/${params.id}`,
    method: 'get',
    params
  })
}

// 更新网站产品
export const editWebsiteProduct = (data: any): Promise<any> => {
  return datashopAxios({
    url: `/api/datashop/v3/website-products/${data.id}`,
    method: 'put',
    data
  })
}

// 删除网站产品
export const deleteWebsiteProduct = (data: any): Promise<any> => {
  return datashopAxios({
    url: `/api/datashop/v3/website-products/${data.id}`,
    method: 'delete',
    data
  })
}

// 创建网站产品
export const addWebsiteProduct = (data: any) => {
  return datashopAxios({
    url: `/api/datashop/v3/website-products`,
    method: 'post',
    data
  })
}
